-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update goshawk v0.1.17 changes #277
Conversation
CLA Assistant Lite bot ✅ All contributors have signed the CLA |
I have read the CLA Document and I hereby sign the CLA |
Code Coverage Summary
Diff against main
Results for commit: 28088a5 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
thanks for opening this PR. once it is merged I will test and then I think the release can be made so that we can upversion other study and data mart apps to the latest version ot teal and goshawk/teal.goshawk. thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kartikeyakirar left just one comment. other than that this is good to go
@npaszty PR is merged. You can install and check this. |
@npaszty I tried to reproduce the mentioned error but was unable to do so. Since you are using the latest version, it should not be causing this issue. Could you please add session info ?
no error or app crash. using below code. sample app for `tm_g_gh_correlationplot`# Example using ADaM structure analysis dataset.
data <- teal_data()
data <- within(data, {
library(dplyr)
library(stringr)
# use non-exported function from goshawk
h_identify_loq_values <- getFromNamespace("h_identify_loq_values", "goshawk")
# original ARM value = dose value
arm_mapping <- list(
"A: Drug X" = "150mg QD",
"B: Placebo" = "Placebo",
"C: Combination" = "Combination"
)
color_manual <- c("150mg QD" = "#000000", "Placebo" = "#3498DB", "Combination" = "#E74C3C")
# assign LOQ flag symbols: circles for "N" and triangles for "Y", squares for "NA"
shape_manual <- c("N" = 1, "Y" = 2, "NA" = 0)
set.seed(1)
ADSL <- rADSL
ADLB <- rADLB
var_labels <- lapply(ADLB, function(x) attributes(x)$label)
ADLB <- ADLB %>%
mutate(AVISITCD = case_when(
AVISIT == "SCREENING" ~ "SCR",
AVISIT == "BASELINE" ~ "BL",
grepl("WEEK", AVISIT) ~
paste(
"W",
trimws(
substr(
AVISIT,
start = 6,
stop = str_locate(AVISIT, "DAY") - 1
)
)
),
TRUE ~ NA_character_
)) %>%
mutate(AVISITCDN = case_when(
AVISITCD == "SCR" ~ -2,
AVISITCD == "BL" ~ 0,
grepl("W", AVISITCD) ~ as.numeric(gsub("[^0-9]*", "", AVISITCD)),
TRUE ~ NA_real_
)) %>%
# use ARMCD values to order treatment in visualization legend
mutate(TRTORD = ifelse(grepl("C", ARMCD), 1,
ifelse(grepl("B", ARMCD), 2,
ifelse(grepl("A", ARMCD), 3, NA)
)
)) %>%
mutate(ARM = as.character(arm_mapping[match(ARM, names(arm_mapping))])) %>%
mutate(ARM = factor(ARM) %>%
reorder(TRTORD)) %>%
mutate(
ANRHI = case_when(
PARAMCD == "ALT" ~ 60,
PARAMCD == "CRP" ~ 70,
PARAMCD == "IGA" ~ 80,
TRUE ~ NA_real_
),
ANRLO = case_when(
PARAMCD == "ALT" ~ 20,
PARAMCD == "CRP" ~ 30,
PARAMCD == "IGA" ~ 40,
TRUE ~ NA_real_
)
) %>%
rowwise() %>%
group_by(PARAMCD) %>%
mutate(LBSTRESC = ifelse(
USUBJID %in% sample(USUBJID, 1, replace = TRUE),
paste("<", round(runif(1, min = 25, max = 30))), LBSTRESC
)) %>%
mutate(LBSTRESC = ifelse(
USUBJID %in% sample(USUBJID, 1, replace = TRUE),
paste(">", round(runif(1, min = 70, max = 75))), LBSTRESC
)) %>%
ungroup()
attr(ADLB[["ARM"]], "label") <- var_labels[["ARM"]]
attr(ADLB[["ANRHI"]], "label") <- "Analysis Normal Range Upper Limit"
attr(ADLB[["ANRLO"]], "label") <- "Analysis Normal Range Lower Limit"
# add LLOQ and ULOQ variables
ADLB_LOQS <- h_identify_loq_values(ADLB, "LOQFL")
ADLB <- left_join(ADLB, ADLB_LOQS, by = "PARAM")
})
datanames <- c("ADSL", "ADLB")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
app <- init(
data = data,
modules = modules(
tm_g_gh_correlationplot(
label = "Correlation Plot",
dataname = "ADLB",
param_var = "PARAMCD",
xaxis_param = choices_selected(c("ALT", "CRP", "IGA"), "ALT"),
yaxis_param = choices_selected(c("ALT", "CRP", "IGA"), "CRP"),
xaxis_var = choices_selected(c("AVAL", "BASE", "CHG", "PCHG"), "BASE"),
yaxis_var = choices_selected(c("AVAL", "BASE", "CHG", "PCHG"), "AVAL"),
trt_group = choices_selected(c("ARM", "ACTARM"), "ARM"),
color_manual = c(
"Drug X 100mg" = "#000000",
"Placebo" = "#3498DB",
"Combination 100mg" = "#E74C3C"
),
shape_manual = c("N" = 1, "Y" = 2, "NA" = 0),
plot_height = c(500, 200, 2000),
facet_ncol = 2,
visit_facet = TRUE,
reg_line = FALSE,
loq_legend = TRUE,
font_size = c(12, 8, 20),
dot_size = c(1, 1, 12),
reg_text_size = c(3, 3, 10),
hline_arb = c(40, 50),
hline_arb_label = "arb hori label",
hline_arb_color = c("red", "blue"),
hline_vars = c("ANRHI", "ANRLO", "ULOQN", "LLOQN"),
hline_vars_colors = c("green", "blue", "purple", "cyan"),
hline_vars_labels = c("ANRHI Label", "ANRLO Label", "ULOQN Label", "LLOQN Label"),
vline_vars = c("ANRHI", "ANRLO", "ULOQN", "LLOQN"),
vline_vars_colors = c("yellow", "orange", "brown", "gold"),
vline_vars_labels = c("ANRHI Label", "ANRLO Label", "ULOQN Label", "LLOQN Label"),
vline_arb = c(50, 70),
vline_arb_label = "arb vert A",
vline_arb_color = c("green", "orange")
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
I checked boxplot and lineplot . did not find dataset name. sample app for `tm_g_gh_boxplot`# Example using ADaM structure analysis dataset.
data <- teal_data()
data <- within(data, {
library(dplyr)
library(nestcolor)
library(stringr)
# use non-exported function from goshawk
h_identify_loq_values <- getFromNamespace("h_identify_loq_values", "goshawk")
# original ARM value = dose value
arm_mapping <- list(
"A: Drug X" = "150mg QD",
"B: Placebo" = "Placebo",
"C: Combination" = "Combination"
)
set.seed(1)
ADSL <- rADSL
ADLB <- rADLB
var_labels <- lapply(ADLB, function(x) attributes(x)$label)
ADLB <- ADLB %>%
mutate(
AVISITCD = case_when(
AVISIT == "SCREENING" ~ "SCR",
AVISIT == "BASELINE" ~ "BL",
grepl("WEEK", AVISIT) ~ paste("W", str_extract(AVISIT, "(?<=(WEEK ))[0-9]+")),
TRUE ~ as.character(NA)
),
AVISITCDN = case_when(
AVISITCD == "SCR" ~ -2,
AVISITCD == "BL" ~ 0,
grepl("W", AVISITCD) ~ as.numeric(gsub("[^0-9]*", "", AVISITCD)),
TRUE ~ as.numeric(NA)
),
AVISITCD = factor(AVISITCD) %>% reorder(AVISITCDN),
TRTORD = case_when(
ARMCD == "ARM C" ~ 1,
ARMCD == "ARM B" ~ 2,
ARMCD == "ARM A" ~ 3
),
ARM = as.character(arm_mapping[match(ARM, names(arm_mapping))]),
ARM = factor(ARM) %>% reorder(TRTORD),
ACTARM = as.character(arm_mapping[match(ACTARM, names(arm_mapping))]),
ACTARM = factor(ACTARM) %>% reorder(TRTORD),
ANRLO = 50,
ANRHI = 75
) %>%
rowwise() %>%
group_by(PARAMCD) %>%
mutate(LBSTRESC = ifelse(
USUBJID %in% sample(USUBJID, 1, replace = TRUE),
paste("<", round(runif(1, min = 25, max = 30))), LBSTRESC
)) %>%
mutate(LBSTRESC = ifelse(
USUBJID %in% sample(USUBJID, 1, replace = TRUE),
paste(">", round(runif(1, min = 70, max = 75))), LBSTRESC
)) %>%
ungroup()
attr(ADLB[["ARM"]], "label") <- var_labels[["ARM"]]
attr(ADLB[["ACTARM"]], "label") <- var_labels[["ACTARM"]]
attr(ADLB[["ANRLO"]], "label") <- "Analysis Normal Range Lower Limit"
attr(ADLB[["ANRHI"]], "label") <- "Analysis Normal Range Upper Limit"
# add LLOQ and ULOQ variables
ALB_LOQS <- h_identify_loq_values(ADLB, "LOQFL")
ADLB <- left_join(ADLB, ALB_LOQS, by = "PARAM")
})
datanames <- c("ADSL", "ADLB")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
app <- init(
data = data,
modules = modules(
tm_g_gh_boxplot(
label = "Box Plot",
dataname = "ADLB",
param_var = "PARAMCD",
param = choices_selected(c("ALT", "CRP", "IGA"), "ALT"),
yaxis_var = choices_selected(c("AVAL", "BASE", "CHG"), "AVAL"),
xaxis_var = choices_selected(c("ACTARM", "ARM", "AVISITCD", "STUDYID"), "ARM"),
facet_var = choices_selected(c("ACTARM", "ARM", "AVISITCD", "SEX"), "AVISITCD"),
trt_group = choices_selected(c("ARM", "ACTARM"), "ARM"),
loq_legend = TRUE,
rotate_xlab = FALSE,
hline_arb = c(60, 55),
hline_arb_color = c("grey", "red"),
hline_arb_label = c("default_hori_A", "default_hori_B"),
hline_vars = c("ANRHI", "ANRLO", "ULOQN", "LLOQN"),
hline_vars_colors = c("pink", "brown", "purple", "black"),
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
using line
using above session info
|
here is my session info. I wonder if the delayed data load environment might be causing differences. we have to use delayed data loading but the sample apps don't. I looked at the syntax for the populating menu content in delyaed data loading and the syntax I'm using appears correct. I tried to revert to the previous version but got an error that the previous version no longer exists in the repository. I'm sure that's probably wrong so I could sort that. thought this would be helpfull to do as comparison. Do you have an OCEAN account? if so then it would be best for you to work in the exact same environment we are working in. the study data are from an open small legacy study and the data folder in our branch contains a symlink to the data so you should be able to run the app locally in the same environment we are running it.
|
I changed the data flow to remove the read from entimICE that necesitated our use of delayed data loading. the data are now read from the file system but both the menu and the incorrect placement of values in the correlation plot issue persist. hopefully you can access OCEAN and help test this out in the study data context. I will keep plugging away at to see if this is a data issue vs. package issue. it would be great to be able to sort this out quickly as we have been working for many weeks on upversioning this app. thanks! |
seems like the menu item that works has a different configuration in the module code than the ones that include the data name
|
@npaszty, Yes, I tested this with examples where delayed data was not passed.
|
part of : insightsengineering/goshawk#243
Exposed the
dot_size
argument inth_lineplot
andth_spaghettiplot